def logging(flag):
	def decorator(fn):
		def inner(a, b):
			if flag == "+":
				print("正在进行加法计算")
			elif flag == "-":
				print("正在进行减法计算")
			return fn(a, b)
		return inner
	return decorator

# 带有参数的装饰器可以拆解成一下三步
# 1. logging("+") => decorator
# 2. @decorator
# 3. add = decorator(add)
@logging("+")
def add(a, b):
	return a + b

@logging("-")
def sub(a, b):
	return a - b



print(add(1, 2))
print(sub(2, 1))